<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Login</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="Flat Dark Web Login Form Responsive Templates, Iphone Widget Template, Smartphone login forms,Login form, Widget Template, Responsive Templates, a Ipad 404 Templates, Flat Responsive Templates" />
    <link href="../static/css/login_register_style.css" rel='stylesheet' type='text/css' />
</head>
<body>
<h1>用户登录登陆</h1>
<div class="login-form">
    <div class="avtar">
        <img src="../static/images/avtar.png" />
    </div>
    <form name="form" method="post" action="/admin/login_backend">
        <div>
            <input type="text" placeholder="Name" name="username" id="user">
        </div>
        <div>
            <input type="password" placeholder="Password" name="password" id="pass">
        </div>
        <input type="text" placeholder="Password" name="adjust" hidden="true" value="liulanqi">
        <!--点击此元素会自动激活验证码-->
        <!--id : 元素的 ID (必须)-->
        <!--data-appid : AppID(必须)-->
        <!--data-cbfn : 回调函数名(必须)-->
        <!--data-biz-state : 业务自定义透传参数(可选)-->
        <!--<div class="signin"><button id="TencentCaptcha"
                data-appid="1302338853"
                data-cbfn="callback"
                type="button"
        >验证登录</button>-->
        <!--</div>-->
        <div >
            <input  type="button" value="登录验证" id="TencentCaptcha" data-appid="1302338853" data-cbfn="callback">
        </div>
    </form>
</div>

<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
<script type="text/javascript" src="../static/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript"></script>

</body>


</html>
<script>
    window.callback = function(res){
        console.log(res)
        var nameText= document.getElementById("user").value;
        var passwordText= document.getElementById("pass").value;
        console.log(nameText);
        console.log("def")
        // res（用户主动关闭验证码）= {ret: 2, ticket: null}
        // res（验证成功） = {ret: 0, ticket: "String", randstr: "String"}
        if(nameText===''||passwordText===''){
            alert("用户名和密码不能为空！！！");
            return
        }
        if(res.ret === 0){
            alert("验证通过");   // 票据
            form.submit();
        }
    }
</script>